package com.itheima.arraylist;

import java.util.ArrayList;

public class ArrayListDemo2 {
    public static void main(String[] args) {
        ArrayList<String> shopinglist = new ArrayList<>();
        shopinglist.add("Java入门");
        shopinglist.add("宁夏枸杞");
        shopinglist.add("黑枸杞");
        shopinglist.add("人字拖");
        shopinglist.add("特级枸杞");
        shopinglist.add("枸杞子");
        System.out.println(shopinglist);
        for (int i = 0; i < shopinglist.size(); i++) {
            String ses = shopinglist.get(i);
            if (ses.contains("枸杞")) {
                shopinglist.remove(ses);
                i--;
            }
        }
        System.out.println(shopinglist);
    }
}
